<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .list {
            width: 100px;
            margin: 0 auto;
            text-align: center;
        }

        details {
            position: relative;
            background: #f5f5f5;
        }

        summary {
            list-style: none;
            font-weight: bolder;
            cursor: pointer;
            user-select: none;
            outline: 0;
        }

        li {
            border: 1px solid #eee;
            border-top: 0;
            list-style: none;
        }

        /* 实现动画的原理 */
        summary::after {
            content: '';
            width: 0;
            height: 0;
            line-height: 0;
            font-size: 0;
            border-left: 5px dashed transparent;
            border-right: 5px dashed transparent;
            border-top: 5px solid #000;
            position: absolute;
            top: 8px;
            right: 5px;
            transition: .3s ease-out;
        }

        [open] summary::after {
            transform: rotate(180deg)
        }

        ul {
            height: 0;
            padding: 0;
            margin-top: 0;
            transition: .3s ease-out;
            overflow: hidden;
        }

        [open]+ul {
            height: auto;
        }
    </style>

</head>

<body>
    <div class="list">
        <details open>
            <summary>商品管理</summary>
            <!-- <p>当前是打开状态</p> -->
        </details>
        <ul>
            <li>商品列表</li>
            <li>添加商品</li>
            <li>所占位置高度由内容决定</li>
        </ul>
    </div>
</body>

</html>